module.exports = function ($scope, $resource, $modalInstance, bean, toaster, FileUploader) {
    $scope.bean;
    $scope.url = '/api/as/mc/shophotserchar/save'
    if (bean) {
        $scope.bean = bean;
        $scope.url = '/api/as/mc/shophotserchar/update'
    } else {
        $scope.bean = {
            keyword: '',
            asrot: 1
        };
    }

    //添加
    $scope.ok = function () {
        $resource($scope.url, {}, {}).save($scope.bean, function (res) {
            if (res.errcode === 0) {
                toaster.success({ title: '', body: '操作成功' });
                $modalInstance.close();
            } else {
                toaster.error({ title: '', body: res.errmsg });
            }
        });
    }

    //取消
    $scope.close = function () {
        $modalInstance.dismiss('cancel');
    }

};